﻿CREATE TABLE [dbo].[tblOrderDetail] (
    [OrderDetailID]        INT      IDENTITY (1, 1) NOT NULL,
    [OrderID]              INT      NOT NULL,
    [ProductID]            INT      NOT NULL,
    [Qty]                  INT      NOT NULL,
    [UnitPrice]            MONEY    NOT NULL,
    [UnitShipping]         MONEY    NOT NULL,
    [SubscriptionCycle]    SMALLINT NULL,
    [ImportDate]           DATETIME NULL,
    [Discount]             FLOAT    NOT NULL,
    [PreferredCarrierCode] int NULL
);
GO
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Defines a single item on an order.  Orders can have multiple details.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblOrderDetail';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The OrderID', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblOrderDetail',
	@level2type = N'COLUMN', @level2name = N'OrderID';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Product Id from the tblProductInfo', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblOrderDetail',
	@level2type = N'COLUMN', @level2name = N'ProductID';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The quantity ordered', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblOrderDetail',
	@level2type = N'COLUMN', @level2name = N'Qty';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The price per unit of the item', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblOrderDetail',
	@level2type = N'COLUMN', @level2name = N'UnitPrice';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The cycle the autoship program is on for that particular item.', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblOrderDetail',
	@level2type = N'COLUMN', @level2name = N'SubscriptionCycle';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Date the record was loaded into this table', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblOrderDetail',
	@level2type = N'COLUMN', @level2name = N'ImportDate';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The discount is a value between 0 and 1 and defines a percentage marked off of the UnitPrice.  The Find price for an line is Qty * UnitPrice * (1 - Discount)', 
	@level0type = N'SCHEMA', @level0name = N'dbo',
	@level1type = N'TABLE', @level1name = N'tblOrderDetail',
	@level2type = N'COLUMN', @level2name = N'Discount';

